home *** CD-ROM | disk | FTP | other *** search
- /* Quickie macro to add names and numbers to the Autodialer */
- /* phonebook. Beta version .7, use with caution. */
- /* This program is copyright 1990, Dan Sugalski. */
- /* The archive it appears in may be freely redistributed */
- /* provided that it remains intact */
-
-
- if ~show(l,"rexxsupport.library") then
- call addlib("rexxsupport.library",0,-30,0)
- if ~show(l,"rexxarplib.library") then
- call addlib("rexxarplib.library",0,-30,0)
-
- called = address()
-
- if called = VLT then do
- screen = ',VLT'
- screenx = screencols(VLT)
- if screenx ~= -1 then do
- screeny = screenrows(VLT)
- end
- else do
- screen = ''
- screenx = screencols()
- screeny = screenrows()
- end
- end
- else do
- screen = ''
- screenx = screencols()
- screeny = screenrows()
- end
-
-
- if (called = "VLT") then do
- address vlt
- rx "{call createhost updater, updater2" screen "}" /* Here we open through VLT, as it */
- end /* called it. We use the VLT screen*/
- /* if it exists. */
- else do
- address command
- run rx '"call createhost updater, updater2"'
- end
-
- call openport(updater2)
-
- do i=1 to 10 while ~showlist(P,UPDATER)
- call delay 50
- end
-
- if ~showlist(p, UPDATER) then do
- say "Can't open Host port!"
- exit 1
- end
-
- if ~open(updatephone,'S:VLTPhone',r) then do
- if ~open(updatephone, 'S:VLTPhone',w) then do
- call postmsg(100,60,"Can't open phone file!")
- call delay 200
- call postmsg()
- exit 1
- end
- else do
- call close(updatephone)
- call open(updatephone, 'S:vltphone',r)
- end
- end
-
- do entr=1 while ~eof(updatephone)
- line = readln(updatephone)
- parse var line phone.name.entr phone.number.entr phone.macro.entr phone.parity.entr phone.strip.entr
- end
-
- call close(updatephone)
-
- entr = entr - 1
-
- do while (phone.name.entr = '')
- entr = entr - 1
- end
-
- call postmsg(300, 75, "One Moment, setting up constants")
-
- winx = screenx - 51
- winy = screeny - 40
-
- tempx = winx-160+16+24-(13+26)
- parity.x1.8n1 = tempx
- parity.x1.8m1 = tempx
- parity.x1.8s1 = tempx
- parity.x1.8e1 = tempx
- parity.x1.8o1 = tempx
-
- tempx = tempx + 34
- parity.x1.8n2 = tempx
- parity.x1.7m1 = tempx
- parity.x1.7s1 = tempx
- parity.x1.7e1 = tempx
- parity.x1.7o1 = tempx
-
- tempx = tempx + 34
- parity.x1.7n2 = tempx
- parity.x1.7m2 = tempx
- parity.x1.7s2 = tempx
- parity.x1.7e2 = tempx
- parity.x1.7o2 = tempx
-
- parity.y1.8n1 = 93
- parity.y1.8m1 = 106
- parity.y1.8s1 = 119
- parity.y1.8e1 = 132
- parity.y1.8o1 = 145
-
- parity.y1.8n2 = 93
- parity.y1.7m1 = 106
- parity.y1.7s1 = 119
- parity.y1.7e1 = 132
- parity.y1.7o1 = 145
-
- parity.y1.7n2 = 93
- parity.y1.7m2 = 106
- parity.y1.7s2 = 119
- parity.y1.7e2 = 132
- parity.y1.7o2 = 145
-
- call postmsg()
-
- call openwindow(UPDATER, 0, 0, winx, winy, "CLOSEWINDOW+GADGETUP", "WINDOWCLOSE+WINDOWDEPTH+WINDOWDRAG", "VLT autodialer phone entry editor")
-
-
- curentry = 1
- if curentry > entr then do
- phone.name.curentry = ''
- phone.number.curentry = ''
- phone.macro.curentry = 'dummy'
- phone.parity.curentry = '8N1'
- phone.strip.curentry = 'No'
- entr = 1
- end
- gadgets = 0
-
- /* trace r */
-
- do dummy1 = 1
- edit.name = phone.name.curentry
- edit.number = phone.number.curentry
- edit.macro = phone.macro.curentry
- edit.parity = phone.parity.curentry
- edit.strip = strip(phone.strip.curentry, 'L')
- call dogadgets
- do dummy2 = 1
- do dummy3 = 1
- token = getpkt(updater2)
- if token = '0000 0000'x then leave
- myarg = getarg(token)
- call reply(token)
- gadgetnum = left(myarg, 2)
-
- select
-
- when myarg = "CLOSEWINDOW" then do
- leave dummy1
- end
-
- when gadgetnum = 01 then do
- edit.name = right(myarg, length(myarg)-2)
- call activategadget(updater, 2)
- end
-
- when gadgetnum = 02 then do
- edit.number = right(myarg, length(myarg)-2)
- call activategadget(updater, 3)
- end
-
- when gadgetnum = 03 then do
- edit.macro = right(myarg, length(myarg)-2)
- call activategadget(updater, 1)
- end
-
- when gadgetnum = 'ST' then do
- edit.strip = right(myarg, length(myarg)-2)
- call dogadgets
- end
-
- when gadgetnum = 'PA' then do
- edit.parity = right(myarg, length(myarg)-2)
- call dogadgets
- end
-
- when gadgetnum = 'NX' then do
- phone.name.curentry = space(strip(edit.name, 'B'),1,'_')
- phone.number.curentry = compress(edit.number)
- phone.macro.curentry = compress(edit.macro)
- phone.strip.curentry = edit.strip
- phone.parity.curentry = edit.parity
- curentry = curentry + 1
- if curentry > entr then curentry = entr
- leave dummy2
- end
-
- when gadgetnum = 'PR' then do
- phone.name.curentry = space(strip(edit.name, 'B'),1,'_')
- phone.number.curentry = compress(edit.number)
- phone.macro.curentry = compress(edit.macro)
- phone.strip.curentry = edit.strip
- phone.parity.curentry = edit.parity
- curentry = curentry - 1
- if curentry < 1 then curentry = 1
- leave dummy2
- end
-
- when gadgetnum = 'NE' then do
- entr = entr + 1
- curentry = entr
- phone.name.entr = ''
- phone.number.entr = ''
- phone.macro.entr = 'dummy'
- phone.strip.entr = 'No'
- phone.parity.entr = '8N1'
- leave dummy2
- end
-
- when gadgetnum = 'SA' then do
- temp = 'dummy value'
- do while (~open(updatephone, 'S:VLTPhone', 'W') & (temp ~= ''))
- temp = request(250, 75, "Can't open S:VLTPhone!",,"Retry", "Cancel")
- end
- if temp ~= '' then do
- do temp = 1 to entr
- if phone.name.temp ~= '' then call writeln(updatephone, phone.name.temp phone.number.temp phone.macro.temp phone.parity.temp phone.strip.temp)
- end
- call close(updatephone)
- end
- else nop
- end
-
- otherwise nop
-
- end
- end
- call waitpkt(updater2)
- end
- end
-
- call closewindow(updater)
- exit 0
-
-
-
- dogadgets:
-
- if gadgets = 1 then
- do d1 = 1 to 24
- call removegadget(UPDATER, d1)
- end
-
- gadgets = 1
-
- call setapen(updater,0)
- call setdrmd(updater, jam1)
- call rectfill(updater,2,12,winx-2, winy-2)
- call setAPen(UPDATER, 1)
- call move(UPDATER,(winx/2)-40, 20)
- call text(UPDATER, "Board Name")
- call move(UPDATER, 80, 50)
- call text(UPDATER, "Phone Number")
- call move(UPDATER, winx - 160 ,50)
- call text(updater, "Macro Name")
- call move(updater, 76, 80)
- call text(updater, "Strip Bit 8?")
- call move(updater, winx-160+16, 80)
- call text(updater, "Parity")
- call move(updater, winx/2 - (24+ 28), 75)
- call text(updater, "Record Number")
- call move(updater, winx/2 - 16, 85)
- call text(updater, curentry)
-
- call addgadget(updater, (winx/2)-61, 30, 1, edit.name, "01%g", 120)
- call addgadget(updater, 33, 60, 2, edit.number, "02%g", 200)
- call addgadget(updater, winx-221, 60, 3, edit.macro, "03%g", 200)
- call addgadget(updater, 76, 90, 4, "Yes", "STY")
- call addgadget(updater, 154, 90, 5, "No", "STN")
- call addgadget(updater, 20, winy-15, 6, "Next", "NX")
- call addgadget(updater, 65, winy-15, 7, "Prev", "PR")
- call addgadget(updater, 110, winy-15, 8, "New", "NE")
- call addgadget(updater, 150, winy-15, 9, "Save", "SA")
-
- tempx = winx-160+16+24-(13+26)
- call addgadget(updater,tempx, 93, 10, "8N1", "PA8N1")
- call addgadget(updater,tempx, 106, 11, "8M1", "PA8M1")
- call addgadget(updater,tempx, 119, 12, "8S1", "PA8S1")
- call addgadget(updater,tempx, 132, 13, "8E1", "PA8E1")
- call addgadget(updater,tempx, 145, 14, "8O1", "PA8O1")
-
- tempx = tempx + 34
- call addgadget(updater,tempx, 93, 15, "8N2", "PA8N2")
- call addgadget(updater,tempx, 106, 16, "7M1", "PA7M1")
- call addgadget(updater,tempx, 119, 17, "7S1", "PA7S1")
- call addgadget(updater,tempx, 132, 18, "7E1", "PA7E1")
- call addgadget(updater,tempx, 145, 19, "7O1", "PA7O1")
-
- tempx = tempx + 34
- call addgadget(updater,tempx, 93, 20, "7N2", "PA7N2")
- call addgadget(updater,tempx, 106, 21, "7M2", "PA7M2")
- call addgadget(updater,tempx, 119, 22, "7S2", "PA7S2")
- call addgadget(updater,tempx, 132, 23, "7E2", "PA7E2")
- call addgadget(updater,tempx, 145, 24, "7O2", "PA7O2")
-
- call SetDrMd(Updater, COMPLEMENT)
- if ((left(edit.strip,1) = "y") | (left(edit.strip,1) = "Y")) then
- call RectFill(updater, 76, 90, 76+26, 99)
- else
- call RectFill(updater, 154, 90, 154+18, 99)
-
- interm = edit.parity
-
- call RectFill(updater, parity.x1.interm, parity.y1.interm, parity.x1.interm + 26, parity.y1.interm + 9)
- return 0
-